<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <%@ include file="/WEB-INF/views/include/head.jsp"%> 
        <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
        <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
        <link rel="stylesheet" href="${ctxStatic}/css/list.css">
        
        <script type="text/javascript">
			$(document).ready(function(){
				
	            // 下拉选框带搜索功能
	            $("#materialTypeCd,#materialUseType").select2();
				searchListForm();
				
			});	
	               
	    	function searchListForm() {
	    		var params = $("#searchForm").serialize();
	    		$("#activity_pane").showLoading();
	    		$.post("${ctx}/inventory/warning/searchList",params, function(result) {
	    			var listHtml = result["inventoryWarning"];
	    			var pageHtml = result["page"];
	    			$("#listHtml").html(listHtml);
	    			$("#paging").html(pageHtml);
	    			$("#activity_pane").hideLoading();
	    		}, 'json');
	    	}
	    	
	        
	        //重置
	        function clean(){
                $("input").val("");
                $('#materialTypeCd,#materialUseType').val('');
                $("#materialTypeCd,#materialUseType").select2(); 
	            searchListForm();
	        }
	        
	        $(document).keydown(function(event){
	        	if(event.keyCode == 13){
	        		searchListForm();
	        	}
	        }); 
	        
        </script> 
    </head>
    <body>
    <form  id="searchForm" method="post">
    <c:set value="<%=ResourcesUtil.getConfig(\"material_Category\")%>" var="materialCategory" />
    <c:set value="<%=ResourcesUtil.getConfig(\"material_UseType\")%>" var="useType" />
        
    <div class="listArea"  id="activity_pane">
	    <div class="listBg">
            <div class="searchArea clearfix">
                <div class="searchLeft clearfix">
                    <div class="searchInp clearfix">
                        <!-- 业务类别 -->
                        <p><spring:message code="material_businessType"/></p>
                        <select class="width-125px" id="materialUseType" name="materialUseType">
                            <option value=""><spring:message code="material_pleaseChoosed"/></option>
                            <c:forEach items="${fns:getDictList(useType)}"   var="type">
                                <option  <c:if test="${fn:split(material.materialUseType,'-')[1] eq type.itemValue}">selected="selected"</c:if> value="${type.itemCode}-${type.itemValue}" > 
                                    ${type.itemName}
                                </option>
                            </c:forEach>
                        </select>
                	</div>
                    <div class="searchInp clearfix">
                        <!-- 物料类别 -->
                        <p><spring:message code="material_materialType"/></p>
                        <select class="width-125px" id="materialTypeCd" name="materialTypeCd">
                            <option value=""><spring:message code="material_pleaseChoosed"/></option>
	                        <c:forEach items="${fns:getDictList(materialCategory)}"   var="category">
	                            <option  <c:if test="${fn:split(material.materialTypeCd,'-')[1] eq category.itemValue}">selected="selected"</c:if> value="${category.itemCode}-${category.itemValue}" > 
	                                ${category.itemName}
	                            </option>
	                        </c:forEach>
                        </select>
                	</div>
                    <div class="searchInp clearfix">
                        <!-- 物料名称 -->
                        <p><spring:message code="material_name"/></p>
                        <input type="text"  id="materialNameCn"  name="materialNameCn"  value="${material.materialNameCn}" >
                    </div>
                    <div class="searchInp clearfix">
                        <!-- 物料颜色 -->
                        <p><spring:message code="material_color"/></p>
                        <input type="text"  id="materialColor"  name="materialColor"  value="${material.materialColor}" >
                    </div>
                    <div class="searchInp clearfix">
                        <!-- 物料成分 -->
                        <p><spring:message code="material_composition"/></p>
                        <input type="text"  id="materialComposition"  name="materialComposition"  value="${material.materialComposition}" >
                    </div>
                </div>
                <div class="searchRight clearfix">
                    <button type="button" id="searchBtn" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                    <button type="button"  onclick="clean();"><spring:message code="material_reset"/></button>
                    <shiro:hasPermission name="inventory:warning:edit">
                    <button type="button" onclick="popup('700px','325px','${ctx}/inventory/warning/show')"><spring:message code="material_create"/></button>
                    </shiro:hasPermission>
                </div>
            </div>
    
            <div class="tableArea">
				<div class="" style="overflow: auto;width: 1293px;padding-top: 36px;height: 714px; ">
                    <table cellpadding="0" class="tableHead">
                        <thead>
                            <tr>
	                            <!-- 序号No. -->
	                            <th><p class="table-No"><spring:message code="common_no"/></p></th>
	                            <!-- 物料图片 -->
	                            <th><p class="table-wltp"><spring:message code="material_pic"/></p></th>
	                            <!-- 编码/物料名称 -->
	                            <th><p class="table-bmwlmc"><spring:message code="material_code_name"/></p></th>
	                            <!-- 业务类别 -->
	                            <th><p class="table-ywlb"><spring:message code="material_businessType"/></p></th>
	                            <!-- 物料类别 -->
	                            <th><p class="table-wllb"><spring:message code="material_materialType"/></p></th>
	                            <!-- 物料颜色 -->
	                            <th><p class="table-wlys"><spring:message code="material_color"/></p></th>
	                            <!-- 物料成分 -->
	                            <th><p class="table-wlcf"><spring:message code="material_composition"/></p></th>
	                            <!-- 物料规格 -->
	                            <th><p class="table-wlgg"><spring:message code="material_spec"/></p></th>
	                            <!-- 季节年份 -->
	                            <th><p class="table-jjnf"><spring:message code="material_seasonAndYear"/></p></th>
	                            <!-- 出厂价-->
	                            <th><p class="table-ccj"><spring:message code="inventoryWarning_MaterialPurchasePrice"/></p></th>
	                            <!-- 预警数量-->
	                            <th><p class="table-yjsl"><spring:message code="inventoryWarning_materialAlertQuantity"/></p></th>
	                            <!-- 描述 -->
	                            <th><p class="table-ms"><spring:message code="material_remarks"/></p></th>
                            </tr>
                        </thead>
                    </table>
                    <table cellpadding="0" class="tableBody">
					    <tbody  id = "listHtml"></tbody>	
                	</table>
            	</div>
        	</div>
        </div>
        <div id = "paging" ></div>
      </div>
      </form>
    </body>
</html>